// pages/juejin/index.js
Page({

  data: {
    maskFlag: false,
    menulist: [
      { "id": "1", "url": "/images/top.png", "title": "商品图", hash: "productBox" },
      { "id": "2", "url": "/images/add.png", "title": "商品评价", hash: "commentBox" },
      { "id": "3", "url": "/images/buy.png", "title": "商品详情", hash: "infoBox" },
    ],
    mainmodel: { "url": "/images/home.png", "title": "菜单" },
    winHeight: '100%',
    toView: 'productBox' //锚点跳转的ID
  },
  onLoad() {
    this.setPageHeight()    
    console.log('toViewClick', this.data.toView)
  },
  setPageHeight() {
    wx.getSystemInfo({
      success: res => {
        this.setData({ winHeight: res.windowHeight + 'px' })
      }
    })
  },
  
  menuItemClick: function (res) {
    console.log('juejin', res)
    this.setData({ toView: res.detail.iteminfo.hash })
  },

  toViewClick: function(e) {
    console.log('toViewClick', e)
    this.setData({ toView: e.target.dataset.hash })
  },
  listenMenuExpand(e) {
    this.setData({ maskFlag: e.detail.expand })
  }
})